package fzu.functiongather.Select;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import fzu.functiongather.Utils.Picker.BandCardListPicker;
import fzu.functiongather.Utils.Picker.OptionPicker;
import fzu.functiongather.R;

/**
 * Created by Administrator on 2016/8/20.
 */
public class SelectActivity extends Activity implements View.OnClickListener {
    private TextView et_authentication_selectedBankID;
    private TextView v_tv_sma_bankName;
    private LinearLayout v_authentication_selecteBank;

    private String bankList[];
    private BandCardListPicker mypicker;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.select_main);
        initView();
    }

    private void initView() {
        et_authentication_selectedBankID = (TextView) findViewById(R.id.et_authentication_selectedBankID);
        v_tv_sma_bankName = (TextView) findViewById(R.id.v_tv_sma_bankName);
        v_authentication_selecteBank = (LinearLayout) findViewById(R.id.v_authentication_selecteBank);
        v_authentication_selecteBank.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.v_authentication_selecteBank:
                getBankAndPro();
                break;
        }
    }

    private void getBankAndPro() {
        bankList = new String[]{"中国工商银行", "中国邮政储蓄银行", "中国银行", "招商银行", "中国光大银行", "平安银行", "兴业银行", "中信银行", "广发银行"};
        //装载银行卡数据
        mypicker = new BandCardListPicker(SelectActivity.this, bankList);
        mypicker.setLineVisible(false);
        mypicker.setSelectedItem(bankList[0]);
        mypicker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
            @Override
            public void onOptionPicked(String option) {

                //设置选择的开户的银行卡文本
                v_tv_sma_bankName.setText(option);

            }
        });
        mypicker.show();
    }
}
